package cn.lijida.weiwei.favor.modules.home.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.lijida.weiwei.favor.commons.constant.Conf;
import cn.lijida.weiwei.favor.commons.utils.ReturnT;
import cn.lijida.weiwei.favor.commons.validator.AddGroup;
import cn.lijida.weiwei.favor.modules.home.entity.FavorHome;
import cn.lijida.weiwei.favor.modules.home.service.IFavorHomeService;

/**
 * <p>
 * 家庭 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2019-12-28
 */
@RestController
@RequestMapping("/home/center")
public class FavorHomeController {

	@Autowired
	private IFavorHomeService homeService;
	
	@PostMapping("home")
	public ReturnT<String> create(@RequestBody @Validated({AddGroup.class}) FavorHome home,@RequestAttribute(Conf.LOGIN_ID) Long loginId) throws Exception{
		
		homeService.create(home,loginId);
		
		return ReturnT.SUCCESS;
	}
}
